扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
private void LoadList (object [] items, ListBox l) { for (int i = 0; i < items.Length;i++) l.Items.Add (items[i].ToString ()); } |
private void LoadList (ICollection items,ListBox l) { foreach (object o in items) l.Items.Add (o.ToString ()); } |
private int TheMonth = 0; [XmlAttribute ("Month")] public int Month { get { return TheMonth; } set { TheMonth = value; } } |
public class KeyboardProcessor { private OnGetLine theFunc = null; public OnGetLine OnGetLineCallback { get { return theFunc; } set { theFunc = value; } } public void Run (){ // Read input. // If there is any listeners, publish: string s; do { s = Console.ReadLine (); if (s.Length == 0) break; if (theFunc != null){ System.Delegate [] funcs =theFunc.GetInvocationList(); foreach (OnGetLine f in funcs) { try { f (s); } catch (Exception e) { Console.WriteLine ("Caught Exception: {0}", e.Message); } } } } while (true); } |
婵″倹鐏夐幃銊╂姜鐢瓕鎻╅崚鍥╂畱閹厖绨$憴顤廡妫板棗鐓欓張鈧弬棰侀獓閸濅椒绗岄幎鈧張顖欎繆閹垽绱濋柇锝勭疄鐠併垽妲勯懛鎶姐€婄純鎴炲Η閺堫垶鍋栨禒璺虹殺閺勵垱鍋嶉惃鍕付娴f娊鈧柨绶炴稊瀣╃閵嗭拷